﻿<?php
	session_start();
	session_start();
	require_once("../class/filter.class.php");
	require_once("../class/admin.class.php");
	$userName = $_POST["userName"];
	$password = $_POST["password"];
	
	//验证数据是否合法
	$class_filter = new Filter();
	$userName = $class_filter->Filter_Input($userName);
	$password = $class_filter->Filter_Input($password);

	$class_admin = new Admin();
	$id_admin = $class_admin->Login($userName,$password);
	if($id_admin > 0)
	{
		//登陆成功
		$_SESSION["Admin_Id"] = $id_admin;
		echo '<script>window.location.href = "../admin/manage.php";</script>';
	}
	else
	{
		echo '<script>alert("账号或密码错误");window.location.href="../admin/index.php";</script>';
	}
?>